Add Decimal32, Decimal64, Decimal128#100729
Conversation
|
Note regarding the |
|
This is on my radar to take a look at; just noting it might be a bit delayed due to other priorities for the .NET 9 release. CC. @jeffhandley |
|
@RaymondHuy can you add test cases for the last few cases you fixed:
I'm good with the PR otherwise and can approve with the added tests. |
|
Hi @PranavSenthilnathan, I have added more test cases following your suggestions:
|
|
@RaymondHuy looks like there's still a couple test failures:
Both are comparing zero ( |
| int diffExponent = current.UnbiasedExponent - other.UnbiasedExponent; | ||
| if (diffExponent < TDecimal.Precision) | ||
| { | ||
| TValue factor = TDecimal.Power10(diffExponent); | ||
| (TValue quotient, TValue remainder) = TValue.DivRem(other.Significand, current.Significand); |
There was a problem hiding this comment.
@RaymondHuy the issue looks to be here and I expect it will still throw for yield return new object[] { Decimal128.Parse("0.5" + new string('0', 300) + "1e-6178"), Decimal128.Epsilon, -1 }; (using -1 as the expected result because the string parses to 0 which is less than Epsilon)
In that case, the exponent will differ but the current.Significand is zero
There was a problem hiding this comment.
Thanks for pointing out. My mistake, let me update it. :(
There was a problem hiding this comment.
Please make sure to add in the relevant test since as well, thanks!
There was a problem hiding this comment.
Hi @tannergooding I have fixed the DivideByZeroException in this commit: 5f534ec
added test case in this commit bae1c3b
Resolve #81376